package demo1;

public class Work811 {
    //求单词数
    public static int getNull1(String se){
        int count=0;
        if(se.length()==0){
            return 0;
        }
        else {
            String[] s=se.split(" ");
            for(String c:s){
                System.out.println(c);
                if(c.length()!=0){
                    count++;
                }
            }
        }
        return  count;
    }
    public static String Se(String s3){
        StringBuilder b=new StringBuilder();
        for(int i=0;i<s3.length();i++){
            char c=s3.charAt(i);
            if(Character .isLetter(c)){
                if(Character.isUpperCase(c)){
                    c=(char)(c+32);
                }
                b.append(c);
            }

        }
        return b.toString();//toString是String方法且StringBuilder早已重写了toString()方法
    }
   public static void main(String[] args){
       int a=getNull1(",,,     koko   kiki");
       System.out.println("单词数为"+a);
       //过滤非字母的字符，并把大写的字母转为小写
       String s2=Se("HW11llo");
       System.out.println("转换后的内容为："+s2);
   }
}
